﻿using System.Collections.ObjectModel;
namespace MetaVideoEditorEvolved.Converter
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Windows.Data;
    using mveEngine;

    public class ActorStringConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            var actor = value as ObservableCollection<UI.Entity.ActorMediaItem>;

            if (actor != null && actor.Count > 0)
            {
                var actorString = new StringBuilder();

                foreach (var member in actor)
                {
                    actorString.Append(member.Name + " - ");
                }

                actorString = actorString.Remove(actorString.Length - 4, 3);

                return actorString.ToString();
            }
            else
            {
                return string.Empty;
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
